import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
const user = {
  namespaced: true,
  state: {
    userSettingVisible: false,
    dialogVisible: false,
    editList: {}
  },
  mutations: {
    editDialog(state, value) {
      state.userSettingVisible = value
    },
    closeDialog(state, value) {
      state.userSettingVisible = value
    },
    editData(state, value) {
      state.editList = value
    },
    AddDialog(state, value) {
      state.dialogVisible = value
    }
  }
}
const roles = {
  namespaced: true,
  state: {
    addUserVisible: false,
    editUserVisible: false,
    settingUserVisible: false
  },
  mutations: {
    addUserVisibleState(state, value) {
      state.addUserVisible = value
    },
    editUserVisibleState(state, value) {
      state.editUserVisible = value
    },
    settingUserVisibleState(state, value) {
      state.settingUserVisible = value
    }
  }
}
const cate = {
  namespaced: true,
  state: {
    AddCateDialogVisible: false,
    EditCateDialogVisible: false
  },
  mutations: {
    AddCateDialogVisibleState(state, value) {
      state.AddCateDialogVisible = value
    },
    EditCateDialogVisibleState(state, value) {
      state.EditCateDialogVisible = value
    }
  }
}
const params = {
  namespaced: true,
  state: {
    addDialogVisible: false,
    editDialogVisible: false,
    editDataId: 0
  },
  mutations: {
    addDialogVisibleState(state, value) {
      state.addDialogVisible = value
    },
    editDialogVisibleState(state, value) {
      state.editDialogVisible = value
    },
    editDataIdChange(state, value) {
      state.editDataId = value
    }
  }
}
const goods = {
  namespaced: true,
  state: {
    addGoodsDialogVisible: false
  },
  mutations: {
    addGoodsDialogVisibleState(state, value) {
      state.addGoodsDialogVisible = value
    }
  }
}
const order = {
  namespaced: true,
  state: {
    locationCascader: false,
    progressDialog: false
  },
  mutations: {
    locationCascaderState(state, value) {
      state.locationCascader = value
    },
    progressDialogState(state, value) {
      state.progressDialog = value
    }
  }
}
export default new Vuex.Store({
  modules: { user, roles, cate, params, goods, order }
})
